package bootstrap

import (
	"Walker/global"
	"github.com/spf13/viper"
	"log"
)

func YmlConfFunc(filename ...string) *viper.Viper  {
	conf :=viper.New()
	if len(filename)==0{
		conf.SetConfigName("app")
	}else{
		conf.SetConfigName(filename[0])
	}
	conf.SetConfigType("yml")
	conf.AddConfigPath(global.BasePath+"/config")
	if err := conf.ReadInConfig(); err != nil {
		log.Fatal("config配置文件加载失败"+err.Error())
	}
	return conf
}
